export const commonConfig = {
    data() {
        return {
            frequencyLimitDay:'',//1天内报警总数
            frequencyLimitHour:'',//1小时内报警总数
            frequencyLimitInterval:'',//两次报警间隔
            typeList:[],//报警类型列表
            ruleType:'',//设备类型id
            ruleTypeModal:false,//报警规则类型弹框
            ruleTypeList: [
                {
                    id: 104,
                    name: "怠机"
                },
                {
                    id: 105,
                    name: "停机"
                },
                {
                    id: 106,
                    name: "工作"
                },
                {
                    id: 107,
                    name: "超速"
                },
                {
                    id: 110,
                    name: "倾斜"
                },
                {
                    id: 101,
                    name: "出区域"
                },
                {
                    id: 102,
                    name: "偷漏油"
                },
                {
                    id: 109,
                    name: "拆解硬件"
                },

            ],//报警规则类型
            typeIdList:[],//设备类型id集合
        }
    },
    methods: {
        //根据id获取名称
        getName(type,arr){
            for (let i = 0; i < arr.length; i++) {
                if (type == arr[i].id) {
                    return arr[i].name
                }
            }
        },
        //新增报警类型
        setRuleType(){
            if(!this.ruleType){
                this.$Modal.warning({
                    title: "提示",
                    content: "请选择报警类型"
                });
                return;
            }
            let obj = {
                type : 4,
                ruleType : this.ruleType,
                frequencyLimitDay : '',
                frequencyLimitHour : '',
                frequencyLimitInterval : '',
            }
            this.typeIdList.push(this.ruleType);
            this.typeList.push(obj)
            this.ruleTypeModal = false;
        },
        //删除报警类型
        delRuleType(index,list){
            list.splice(index,1);
            this.typeList = list;
        },
    },
}
